package day05.localDate;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;

/**
 * @author yangwenqi
 * @decs TODO
 * @date 2025/4/25
 * 3.一批食品的生产日期是：2024-5-10，保质期：180天，求过期时间

 */
public class Test3 {
    public static void main(String[] args) {
        String data = "2024-05-10";
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate productionDate = LocalDate.parse(data, formatter);
        int shelfLife = 180;
        LocalDate expirationDate = productionDate.plusDays(shelfLife);
        System.out.println("过期时间: " + expirationDate);
    }
}
